package elven.d.common.queue.sample.print;

import java.util.concurrent.LinkedBlockingQueue;

/**
 * 打印机对象
 * @author liuyy
 */
public class PrinterConsumer extends Thread{
	
	//打印机数量
	private static final int printerSize = 10;
	
	//总打印数量
	private transient LinkedBlockingQueue<PrinterPreducer> blockingQueue;
	
	public PrinterConsumer(LinkedBlockingQueue<PrinterPreducer> preducers) {
		this.blockingQueue = preducers;
	}
	
	@Override
	public void run() {
		try {
			while(true){
				synchronized (blockingQueue) {
					blockingQueue.take().start();
				}
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	
}
